package 
{
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author DarkGoodWIN
	 */
	public class TCaseRoom extends TModalWindow
	{
		protected var Case: TPictureControl = null;
		protected var MoneyText: Ttext = null;
		protected var Info: TNaperstokInfo = null;
		
		private function OnCloseClick(e: MouseEvent): void
		{
			Close();
		}
				
		protected function UpdateMoneyText(): void
		{
			Info.UpdateMoneyText();
			MoneyText.Text = "Бубли: " + Info.Money.toString();
		}
		
		protected function CreatePrize(Index: int): TPrise
		{
			return new TPrise(this, Index, this);			
		}

		protected function AddPrize(Index: int): void
		{
			CurrentCont().AddControl(CreatePrize(Index));
		}
		
		public function CurrentCont(): TContainer
		{
			return null;
		}
		
		public function OnPriseClick(P: TPrise): void
		{
		}
		
		public function OnPriseMDown(P: TPrise, X: int, Y: int): void
		{
		}
		
		public function OnPriseMUp(P: TPrise, X: int, Y: int): void
		{
		}
		
		public function TCaseRoom(anInfo: TNaperstokInfo): void
		{
			super(1);
			
			//todo: refactoring with Naperstok Info
			MoneyText = new Ttext(" ", this, 300, 20, false);
			MoneyText.Height = 300;
			MoneyText.Width = 1000;

			Info = anInfo;
			Case = new TPictureControl(res.Case, this, 10, 90);
			Case.Width = 520;
			Case.Height = 500;
			
			var CloseBtn: InvControl = new InvControl(res.close, this, 787, 5);
			CloseBtn.addEventListener(MouseEvent.CLICK, OnCloseClick);
			
			UpdateMoneyText();
		}
	}
	
}